#include <iostream>
using namespace std;

class Demo {
private:
	int n;
public:
	Demo(int i = 0) :n(i) {}
	Demo& operator++();
	Demo operator++(int);
	friend Demo& operator--(Demo& d);
	friend Demo operator--(Demo& ,int);
	friend ostream& operator<<(ostream& out, const Demo& d);
};

Demo& Demo::operator++()
{
	n++;
	return *this;
}

Demo Demo::operator++(int i)
{
	Demo tmp(*this);
	n++;
	return tmp;
}

Demo& operator--(Demo& d)
{
	d.n--;
	return d;
}

Demo operator--(Demo& d,int i)
{
	Demo tmp(d);
	d.n--;
	return tmp;
}

ostream& operator<<(ostream& out, const Demo& d) {
	out << d.n;
	return out;
}

int main()
{
	Demo d(5);
	cout << (d++) << ",";
	cout << d << ",";
	cout << (++d) << ",";
	cout << d << endl;
	cout << (d--) << ",";
	cout << d << ",";
	cout << (--d) << ",";
	cout << d << endl;
	return 0;
}